<%@ page contentType="text/html" pageEncoding="UTF-8"%>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<div id="wrapper">
    <div class="main clearfix">
        <div class="col_730">        
            <div align="center">
                <h2>Edit Student</h2>
                <table border="0" width="100%">
                    <form:form action="${baseUrl}/cp/savestudentdetail.html" method="POST" commandName="studentForm">
                        <tr>
                            <td>Code</td>
                            <td><form:input path="code" value="${dataStudent.code}" size="30"/></td>
                            <td><form:errors path="code" cssClass="error"/></td>
                        </tr>
                        <tr>
                            <td>Name</td>
                            <td><form:input path="name" value="${dataStudent.name}" size="30"/></td>
                            <td><form:errors path="name" cssClass="error"/></td>
                        </tr>
                        <tr>
                            <td align="left" width="20%">Class </td>
                            <td>
                                <select id="classId" name="classId">
                                    <c:forEach var="classes" items="${dataClasses.data}">
                                        <option value="${classes.id}" <c:if test="${classes.id == dataStudent.classId}">selected="selected"</c:if>>${classes.name}</option>
                                    </c:forEach>
                                </select>
                            </td>
                            <td align="left"><form:errors path="class" cssClass="error"/></td>
                        </tr>

                        <tr>
                            <td><form:hidden path="id" value="${dataStudent.student_id}"/></td>
                            <td align="left">
                                <input type="submit" value="Edit"/>
                                <input type="button" onclick="formCancel('${baseUrl}/cp/students.html');" value="Cancel"/>
                            </td>
                            <td align="left"></td>
                        </tr>
                    </form:form>
                </table>
            </div> 
        </div> 
    </div>
</div>
<script type="text/javascript">
                                    sz_Response = "${sz_Response}";
                                    if (sz_Response !== "")
                                    {
                                        alert(sz_Response);
                                    }
</script>